{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CART (Classification And Regression Tree)\n",
    "#### 根据某一个维度d 和 某一阈值v 进行二分\n",
    "#### scikit-learn的决策树实现都是 CART \n",
    "(其他方法还有ID3, C4.5, C5.0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 复杂度\n",
    "#### 预测: Olog(m) , m为样本个数\n",
    "#### 训练: O(n\\*m\\*log(m)) , 还容易过拟合"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 所以需要 剪枝: 降低复杂度, 解决过拟合"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn import datasets\n",
    "\n",
    "X, y = datasets.make_moons(noise=0.25, random_state=666)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAD8CAYAAACfF6SlAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAHU1JREFUeJzt3X2MXFd5x/HvE8eQpa28CTYkWXvrpE0Dea1hFV5cVWlcGhKaxA0hTfiDUBFZtI1oUymqUSVjRariNFKjpqFFhiKCVEJMAGOKkdvGICrapFmT2E4IBhOg7DoiIRC3CJf65ekfcwfPzt6ZuTP3zL3n3vv7SNbOzlzPPXt39pkzz3nOOebuiIhIs5xSdgNERKR4Cv4iIg2k4C8i0kAK/iIiDaTgLyLSQAr+IiINpOAvItJACv4iIg0UJPib2UfN7Hkze6rH45eb2WEz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gBX8RkQZS8BcRaSAFfxGRBvp/RNEY8SiTfQkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1b8192c6630>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[y==0, 0], X[y==0, 1])\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DecisionTreeClassifier(class_weight=None, criterion='gini', max_depth=None,\n",
       "            max_features=None, max_leaf_nodes=None,\n",
       "            min_impurity_decrease=0.0, min_impurity_split=None,\n",
       "            min_samples_leaf=1, min_samples_split=2,\n",
       "            min_weight_fraction_leaf=0.0, presort=False, random_state=None,\n",
       "            splitter='best')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.tree import DecisionTreeClassifier\n",
    "\n",
    "dt_clf = DecisionTreeClassifier()\n",
    "dt_clf.fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_decision_boundary(model, axis):\n",
    "    x0, x1 = np.meshgrid(\n",
    "        np.linspace(axis[0], axis[1], int((axis[1]-axis[0])*100)),\n",
    "        np.linspace(axis[2], axis[3], int((axis[3]-axis[2])*100))\n",
    "    )\n",
    "    x_new = np.c_[x0.ravel(), x1.ravel()]\n",
    "    \n",
    "    y_predict = model.predict(x_new)\n",
    "    zz = y_predict.reshape(x0.shape)\n",
    "    from matplotlib.colors import ListedColormap\n",
    "    custom_cmap = ListedColormap(['#EF9A9A', '#FFF59D', '#90CAF9'])\n",
    "    plt.contourf(x0, x1, zz, linewidth=5, cmap=custom_cmap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\fangyang\\Anaconda3\\lib\\site-packages\\matplotlib\\contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3X2MHdWZ5/Hv4+6GbkPbxhiPGxvjMGAvbytsEBvGTBYxZoStDGR2nIkzGw1BGVlslkA22mQzsuRZIUUTJlIUApmJHIYMWSJI0rNLzGIPi3FYGO+Sxbwa44EYFKDtTuzguN2GNvTL2T+6bvv27bqvVbfqVNXvI1m+XX371um6feupes5zzjHnHCIiIrPSboCIiPhBAUFERAAFBBERCSggiIgIoIAgIiIBBQQREQFiCghmdp+ZHTKzV6p8/xozGzKzF4N/m+PYr4iIxKczptf5B+Ae4Ac1nvO0c+7jMe1PRERiFssdgnPuKeBIHK8lIiLpiOsOoRFXmdlLwEHgPzvn9lY+wcw2AhsBTjv11MsvWLQoweZJEbzbcyYAC3veZbxglzAd8+HQyJkztrdyLErHUfzzzr88/xvn3Fmt/GxSAeF54Fzn3HEzWwc8DFxQ+STn3BZgC8DKZcvczzZtSqh5UhT3X3YTALdf/ABHfziecmuSNe/fd3DX3s/M2N7KsSgdR/HPF6889a1WfzaRKiPn3DHn3PHg8Tagy8wWJLFvERFpTCIBwcwWmZkFj68M9vtuEvsWEZHGxJIyMrMHgWuABWY2APwV0AXgnPsusB74D2Y2BowAG5ymWRUR8UosAcE59+k637+HybJUERHxlEYqi4gIkGzZqWTUtuEe7j7Sy6/GOljUOc4X5g+zrnck7WaJSMwUEHKkHSfubcM93HF4Lifc5M3k4FgndxyeC6CgIJIzShnlROnEPTjWicOmTtzbhnsive7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ez0TXQ4hhGgyA1c65g2a2EHjczP4luPKITZLTdURRq51NvMzS4HieB+w0sz3OuTfiaWFVjRyfRI5hHY204RHgQefcB2Z2C5N3Nde2vWXN8eFYNuJ54Fzn3HEzWwc8DFyQRkPM7HTgH4EvOueOVX475EdSOZ512tn08Uw0ILjo02DgnDsY/H/IzP4Hk7f1sQaEGNqZyHQdtdppZr82sz7n3GBwO3uoymuUjuebZvYkk1ca7Q4IjRyf0nMGzKwTmEvy6Ya67XTOvVv25feAOxNoV7MyMX1M+QnNObfNzP7WzBY45xKdUM7Mupg8yf7QOfffQ57ixfGs185WjmemUkZmdpqZ9ZYeA3/I5JoMvvFhuo6twE3B45uAGXc2ZnaGmZ0aPF4ArCaZacm2LTZgAAABJklEQVQbOT7l7V8P7HRBT1mC6razInd8A5O5XN9sBf48qI75KDBUSif6xMwWlfqJzOxKJs9P79b+qdjbYMDfA/ucc9+s8rTUj2cj7WzpeCbdO16j1/yPmYy8HwC/Bh4Ltp8NbAsen8dkpcdLwF4mUzjetdOdrER4ncmr7TTaeSbwBPCL4P/5wfYrgHuDx78H7AmO5x7gcwm2b8bxAe4AbggedwM/AfYD/w84L6W/y3rt/Ovgb/El4GfAv0qhjQ8Cg8Bo8Lf5OeAW4Jbg+8bkIlVvBO9z1Sq+lNt5a9mxfAb4vRTaeDWT6Z+XgReDf+t8O54NtrPp46mpK0REBMhYykhERNpHAUFERAAFBBERCSggiIgIoIAgIiIBBQQREQEUEEREJPD/AXWgIt7NTAxJAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1b819110c88>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(dt_clf, axis=[-1.5,2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0, 0], X[y==0, 1])\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\fangyang\\Anaconda3\\lib\\site-packages\\matplotlib\\contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAHyNJREFUeJzt3X+QHOWd3/H3V7trtHCDFiE4rSV+GIMUMOSsH8XZJy7F+UQKqRLI5eQyzh+HKVwq4mDn4rq6c0opXYo6KuZSRXIHvlzJHHeQSmHHusQWsRSCLDu+6IKDwGB+yMiC2GalxcIoSAus8P745o/tWXZnZ3Z6pnu6n+7+vKpUmp3tnX62Z6e//Xyf7/O0uTsiIiJL8m6AiIiEQQFBREQABQQREYkoIIiICKCAICIiEQUEEREBUgoIZvagmZ0ws+dbfP96MztlZs9E/3amsV8REUlPf0qv81fA/cDDi2zzN+7+D1Lan4iIpCyVHoK7fxc4mcZriYhIPtLqIcTxUTN7FjgO/J67v9C4gZltB7YDnHPWWRuuWLkyw+aJSFxvDJ6fdxOkhVd/+PTP3f2Cbn42q4DwNHCJu79lZluBrwNXNG7k7ruAXQDrLr3Uv71jR0bNE5FOPPThW/NugrTwu9ee9ZNufzaTKiN3P+3ub0WP9wIDZrYii32LiEg8mQQEM1tpZhY9vjba7xtZ7FtEROJJJWVkZo8A1wMrzGwE+ENgAMDd/xzYBvxTM5sExoFbXMusiogEJZWA4O6fbPP9+5kpSxURkUBpprKIiADZlp1KQe0dG+S+kzVem+xjZf8Un10+xtbaeN7NEpGUKSCUSC9O3HvHBrnr9WWc8ZnO5OhkP3e9vgxAQUGkZJQyKon6iXt0sh/HZk/ce8cGE73ufSdrs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4PcFlOf5ft2vlvor/FZ4FvA38nhzY+AowCE9Hf5u3AHcAd0feNmZtUvRy9zy2r+HJu551zjuUTwK/l0MbrmEn//AB4Jvq3NbTjGbOdHR9PLV0hIiJAwVJGIiLSOwoIIiICKCCIiEhEAUFERAAFBBERiSggiIgIoIAgIiKR/w/xxuvtHQHv8QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1b819112c18>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "dt_clf2 = DecisionTreeClassifier(max_depth=2)\n",
    "dt_clf2.fit(X, y)\n",
    "\n",
    "plot_decision_boundary(dt_clf2, axis=[-1.5,2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0, 0], X[y==0, 1])\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\fangyang\\Anaconda3\\lib\\site-packages\\matplotlib\\contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAHw9JREFUeJzt3X+QHOWd3/H3V7trtOhWEkJwWkv8MAdS+JUgUHH2iUtRPpFCqgTlcnJZTqUOU7hUxMH2xZW685WqdCmqXDGXKhIbfLmSOXyQc4FjXWKLWApBlh07uuDw2/zQgQWxzUprC6NDWmCF98c3f2zPMjs7s9Mz3dP9dPfnVaXS7Gzv9LM9O/3t5/t8n6fN3REREVmUdwNERCQMCggiIgIo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7Hs007Oz6emQYET74MBu5+LPr/uJn9N2a69akGhBTamclyHQu108x+YWbD7j4adWePt3iN2vF81cy+x8yVRq8DQpzjU9tmxMz6gWVkn25o2053f6Puy68Ad2bQrk4VYvmY+hOau+8zsz8zs5XunumCcmY2wMxJ9mvu/l+bbBLE8WzXzm6OZ6FSRma2xMyGao+Bf8TMPRlCE8JyHXuBm6PHNwPzejZmdpaZnRE9XglsJJtlyeMcn/r2bwMOejRSlqG27WzIHd/ETC43NHuB34+qYz4InKylE0NiZqtq40Rmdi0z56c3Fv6p1NtgwF8Ah939rhab5X4847Szq+OZ9ej4AqPmv8tM5H0X+AXwSPT8+4F90eOLmKn0eBZ4gZkUTnDt9PcqEV5m5mo7j3aeDXwH+HH0/4ro+Q3AvdHj3wKei47nc8CtGbZv3vEB7gBuih4vBr4BHAH+L3BRTn+X7dr576K/xWeB7wJ/L4c2PgiMAhPR3+atwG3AbdH3jZmbVL0Svc8tq/hybuftdcfyMeC3cmjjdcykf34EPBP92xLa8YzZzo6Pp5auEBERoGApIxER6R0FBBERARQQREQkooAgIiKAAoKIiEQUEEREBFBAEBGRyP8HT13bzUwTCOoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1b8191107b8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "dt_clf3 = DecisionTreeClassifier(min_samples_split=10)\n",
    "dt_clf3.fit(X, y)\n",
    "\n",
    "plot_decision_boundary(dt_clf3, axis=[-1.5,2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0, 0], X[y==0, 1])\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\fangyang\\Anaconda3\\lib\\site-packages\\matplotlib\\contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      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T8LXAU+L/A5Tl9Lju18z9Hn8Wnge8C/yqHNn4DmACmo8/mp4DbgNuix435i1S9GL3PLav4cm7n7XX78lHgwzm08Trm0z8/Ap6K/m0LbX/GbGfX+1NLV4iICFCwlJGIiPSPAoKIiAAKCCIiElFAEBERQAFBREQiCggiIgIoIIiISOT/AyV89dS0yQOQAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1b818fc6fd0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "dt_clf4 = DecisionTreeClassifier(min_samples_leaf=6)\n",
    "dt_clf4.fit(X, y)\n",
    "\n",
    "plot_decision_boundary(dt_clf4, axis=[-1.5,2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0, 0], X[y==0, 1])\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\fangyang\\Anaconda3\\lib\\site-packages\\matplotlib\\contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAHyNJREFUeJzt3X+QHOWd3/H3V7trtHCDFiE4rSV+GIMUMOSsH8XZJy7F+UQKqRLI5eQyzh+HKVwq4mDn4rq6c0opXYo6KuZSRXIHvlzJHHeQSmHHusQWsRSCLDu+6IKDwGB+yMiC2GalxcIoSAus8P745o/tWXZnZ3Z6pnu6n+7+vKpUmp3tnX62Z6e//Xyf7/O0uTsiIiJL8m6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ZHcz0aj7W85Z1JoRjGcfTwCXu/paZbQW+DlyRR0PM7JeAvwZ+191PN367yY/kcjzbtLPj45lpQPDky2Dg7sej/0+Y2X9lplufakBIoZ2ZLNexWDvN7GdmNuzuo1F39kSL16gfz1fM7DvMXGn0OiDEOT71bUbMrB9YRvbphrbtdPc35nz5ZeCeDNrVqUIsHzP3hObue83sz8xshbtnuqCcmQ0wc5L9T+7+X5psEsTxbNfObo5noVJGZnaOmdXqj4G/z8w9GUITwnIde4Bbo8e3Agt6NmZ2npmdFT1eAWwim2XJ4xyfue3fBhzwaKQsQ23b2ZA7vomZXG5o9gC/E1XHfAQ4VU8nhsTMVtbHiczsWmbOT28s/lOpt8GAvwAOu/u9LTbL/XjGaWdXxzPr0fFFRs1/i5nI+y7wM+Cx6Pn3A3ujx5cxU+nxLPACMymc4Nrp71UiHGHmajuPdp4PfAv4UfT/8uj5jcAD0eNfA56LjudzwO0Ztm/B8QHuAm6KHi8FvgYcBf4PcFlOf5ft2vlvor/FZ4FvA38nhzY+AowCE9Hf5u3AHcAd0feNmZtUvRy9zy2r+HJu551zjuUTwK/l0MbrmEn//AB4Jvq3NbTjGbOdHR9PLV0hIiJAwVJGIiLSOwoIIiICKCCIiEhEAUFERAAFBBERiSggiIgIoIAgIiKR/w/xxuvtHQHv8QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1b818a3e390>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "dt_clf5 = DecisionTreeClassifier(max_leaf_nodes=4)\n",
    "dt_clf5.fit(X, y)\n",
    "\n",
    "plot_decision_boundary(dt_clf5, axis=[-1.5,2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0, 0], X[y==0, 1])\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
